<template>
  <div class="home-content">
    <el-row :gutter="20" class="stats-row">
      <el-col :span="6">
        <el-card class="stat-card">
          <div class="stat-title">今日新增用户</div>
          <div class="stat-value">35</div>
        </el-card>
      </el-col>
      <el-col :span="6">
        <el-card class="stat-card">
          <div class="stat-title">今日新增帖子</div>
          <div class="stat-value">128</div>
        </el-card>
      </el-col>
      <el-col :span="6">
        <el-card class="stat-card">
          <div class="stat-title">待审核帖子</div>
          <div class="stat-value">8</div>
        </el-card>
      </el-col>
      <el-col :span="6">
        <el-card class="stat-card">
          <div class="stat-title">系统消息</div>
          <div class="stat-value">3</div>
        </el-card>
      </el-col>
    </el-row>

    <el-row :gutter="20" class="main-panels">
      <el-col :span="12">
        <el-card shadow="hover" class="panel-card">
          <div class="panel-header">帖子统计</div>
          <el-table :data="postStats" style="width: 100%">
            <el-table-column prop="category" label="分类" />
            <el-table-column prop="count" label="数量" width="100" />
          </el-table>
        </el-card>
      </el-col>

      <el-col :span="12">
        <el-card shadow="hover" class="panel-card">
          <div class="panel-header">活跃用户排行榜</div>
          <el-table :data="activeUsers" style="width: 100%">
            <el-table-column prop="rank" label="排名" width="60" />
            <el-table-column prop="username" label="用户名" />
            <el-table-column prop="posts" label="发帖数" width="100" />
          </el-table>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script setup>
import { ref } from 'vue'

const postStats = ref([
  { category: '技术讨论', count: 1523 },
  { category: '资源分享', count: 845 },
  { category: '问答交流', count: 730 },
  { category: '公告通知', count: 23 },
])

const activeUsers = ref([
  { rank: 1, username: 'coder01', posts: 321 },
  { rank: 2, username: 'dev_girl', posts: 298 },
  { rank: 3, username: 'vue_master', posts: 267 },
  { rank: 4, username: 'forumKing', posts: 245 },
  { rank: 5, username: 'happyUser', posts: 230 },
])
</script>

<style scoped>
.home-content {
  padding: 20px;
  background-color: #f5f7fa;
  min-height: 100%;
}

.stats-row {
  margin-bottom: 20px;
}

.stat-card {
  text-align: center;
  padding: 20px 0;
}

.stat-title {
  font-size: 16px;
  color: #606266;
  margin-bottom: 12px;
}

.stat-value {
  font-size: 32px;
  color: #409EFF;
  font-weight: bold;
}

.main-panels {
  margin-top: 20px;
}

.panel-card {
  background: white;
}

.panel-header {
  font-weight: 600;
  font-size: 18px;
  margin-bottom: 10px;
}
</style>
